package com.eight.vote.controller;


import com.eight.vote.service.CategoryService;
import com.eight.vote.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 点点星言
 * @since 2022-10-16
 */
@RestController
@RequestMapping("api/vote/category")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("count")
    public Result count(){
        return categoryService.countFromDB();
    }

    @GetMapping("getAll")
    public Result getAllCategory(){
        return categoryService.getAllCategory();
    }

}

